package com.cloudbroker.openapi.manage.controller;

import com.cloudbroker.bcs.common.util.VOUtil;
import com.cloudbroker.bcs.platform.ltb.bizapi.service.market.back.MarketBackVo;
import com.cloudbroker.bcs.platform.ltb.bizapi.service.market.back.StockIndustryList;
import com.cloudbroker.bcs.platform.ltb.bizapi.service.market.vo.MarketVo;
import com.cloudbroker.bcs.platform.ltb.bizapi.service.market.vo.StockIndustryQryForm;
import com.cloudbroker.bcs.platform.ltb.bizapi.t2service.business.MarketT2BizService;
import com.cloudbroker.bcs.platform.ltb.common.ext.annotation.SaveLog;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

import static com.cloudbroker.bcs.platform.ltb.common.util.RequestUtil.getSingleParameterMapForBody;

/**
 * Created by daibd19671 on 2016/8/20.
 */
@Controller
public class MarketController {
    @Resource
    private MarketT2BizService marketBizService;

    @ResponseBody
    @RequestMapping("/get_market_token")
    @SaveLog(remark = "获取行情token")
    public MarketBackVo get_market_token(HttpServletRequest request, String jsonpcallback){
        MarketVo form = getSingleParameterMapForBody(request,MarketVo.class);
        return VOUtil.setJsonpResult(marketBizService.getMarketToken(form),jsonpcallback);
    }

    @ResponseBody
    @RequestMapping("/stock_industry_qry")
    @SaveLog(remark = "获取股票行业")
    public StockIndustryList getStockIndustry(HttpServletRequest request, String jsonpcallback){
        StockIndustryQryForm form = getSingleParameterMapForBody(request,StockIndustryQryForm.class);
        return VOUtil.setJsonpResult(marketBizService.getStockIndustry(form),jsonpcallback);
    }


}
